﻿<!DOCTYPE html>
<html lang="ch">
<head>
	<meta charset="utf8">
	<title>手机归属地查询</title>
	<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" type="text/css" href="layui/css/layui.css">
</head>
<body>
	
    <div class="layui-container">


	    <div class="layui-row">

	        <a href="index.php"><i class="layui-icon layui-icon-left" style="font-size:20px"></i><div class="doc-icon-name">返回</div></a>

        </div>
        
        <hr>

		<div class="layui-row" style="padding:10px;">

			

			<button type="button" class="layui-btn layui-bg-red" onclick="querTell()" >查询</button>

			<button type="button" class="layui-btn layui-bg-red" onclick="daoChu()" >导出Excel</button>

			
		</div>
		
		<div class="layui-row layui-col-space10 ">
			 
			
				<div class="layui-col-md2" >

					<div style="height:10px;"></div>
					
					<textarea id="tells" name="" required lay-verify="required" placeholder="请输入电话" class="layui-textarea" style="height: 500px;"></textarea>

				</div>

				<div class="layui-col-md10" >

					<table id="tableTell" lay-filter="tableTell"></table>
					
				</div>


		</div>


	</div>


</body>
</html>

<script src="layui/layui.all.js"></script>
<script>

	   var ziZhangHao_field=[{field:'tell',title:'手机号码',sort:true},{field:'province',title:'省份',sort:true},{field:'city',title:'城市',sort:true},{field:'isp',title:'通信',sort:true}]	

       var table = layui.table;
       
       var cols=[ziZhangHao_field]

       var table1=table.render({
         elem: '#tableTell'
        // ,toolbar: '#toolbarDemo'
        ,height: 900
        ,defaultToolbar: ['filter', 'exports', 'print', { //自定义头部工具栏右侧图标。如无需自定义，去除该参数即可
           title: '提示'
          ,layEvent: 'LAYTABLE_TIPS'
          ,icon: 'layui-icon-tips'
        }]
        ,url: 'mingxi.php' //数据接口
        ,method:'post'
        ,where:{type:32,tells:''}
        ,page: false //开启分页
        ,cols:cols

      });

	

	function querTell(){


		var layer=layui.layer;

		layer.prompt({title: '输入口令，并确认', formType: 1}, function(pass, index){


		  layer.close(index);

		  $.post(

			  	'mingxi.php',

			  	{type:33},

			  	function(data,status){

			  		var data=JSON.parse(data)

			  		var pass1=data[0].pass

			  		if(pass!==pass1){

					  	layer.msg('密码错误')


					  }else{


				  			var tells=$('#tells')[0].value;

							var reg=/\d+/g;

							var tellsAo=[];


							for(var i=0;i<tells.match(reg).length;i++){

								

								tellsAo.push({tell:tells.match(reg)[i]})

							}

							var jsonTell=JSON.stringify(tellsAo)

							table.reload('tableTell',{

								 url: 'mingxi.php' //数据接口
						        ,method:'post'
						        ,where:{type:32,tells:jsonTell}
								}

							)

					  }


			  	}
	  		)	

		});


	}

	function daoChu(){


		table.exportFile(table1.config.id, table1.data); //data 为该实例中的任意数量的数据
	}


</script>